<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});




Route::get('home',['uses'=>'Home\IndexController@index','as'=>'home.index']);
Route::get('home/show/{name?}',['uses'=>'Home\IndexController@show','as'=>'home.show']);

//支付宝支付处理
Route::get('alipay/pay','Home\AlipayController@pay');
//支付后跳转页面
Route::post('alipay/return','Home\AlipayController@result');



// admin后台
Route::get('admin/login',['uses'=>'Admin\LoginController@index','as'=>'admin.login.index']);
Route::post('admin/login/save',['uses'=>'Admin\LoginController@save','as'=>'admin.login.save']);

Route::group(['prefix' => 'admin', 'namespace' => 'Admin', 'middleware' => 'admin.auth'], function()
{
    Route::get('/', function () {
        return redirect()->to('/index');
    });
    // 首页
    Route::get('/index',['uses'=>'IndexController@index','as'=>'admin.index.index']);
    // 删除登录session
    Route::get('login/delete',['uses'=>'LoginController@delete','as'=>'admin.login.delete']);

    // 文章内容管理
    Route::get('/article/index',['uses'=>'ArticleController@index','as'=>'admin.article.index']);
    Route::get('/article/add',['uses'=>'ArticleController@add','as'=>'admin.article.add']);
    Route::get('/article/{id}/edit',['uses'=>'ArticleController@edit','as'=>'admin.article.edit']);
    Route::get('/article/{id}/delete',['uses'=>'ArticleController@delete','as'=>'admin.article.delete']);
    Route::post('/article/save',['uses'=>'ArticleController@save','as'=>'admin.article.save']);
    Route::post('/article/{id}/update',['uses'=>'ArticleController@update','as'=>'admin.article.update']);

    // 分类管理
    Route::get('/category',['uses'=>'CategoryController@index','as'=>'admin.category.index']);
    Route::get('/category/add',['uses'=>'CategoryController@add','as'=>'admin.category.add']);
    Route::get('/category/{id}/edit',['uses'=>'CategoryController@edit','as'=>'admin.category.edit']);
    Route::get('/category/{id}/{parent_id}/delete',['uses'=>'CategoryController@delete','as'=>'admin.category.delete']);
    Route::post('/category/save',['uses'=>'CategoryController@save','as'=>'admin.category.save']);
    Route::post('/category/{id}/update',['uses'=>'CategoryController@update','as'=>'admin.category.update']);

    // 单页管理
    Route::get('/single_page/index',['uses'=>'SinglePageController@index','as'=>'admin.singlePage.index']);
    Route::get('/single_page/add',['uses'=>'SinglePageController@add','as'=>'admin.singlePage.add']);
    Route::get('/single_page/{id}/edit',['uses'=>'SinglePageController@edit','as'=>'admin.singlePage.edit']);
    Route::get('/single_page/{id}/delete',['uses'=>'SinglePageController@delete','as'=>'admin.singlePage.delete']);
    Route::post('/single_page/save',['uses'=>'SinglePageController@save','as'=>'admin.singlePage.save']);
    Route::post('/single_page/{id}/update',['uses'=>'SinglePageController@update','as'=>'admin.singlePage.update']);

    // 上传文件
    Route::controller('upload', 'UploadController');
    Route::post('/upload_img/ajax',['uses'=>'UploadImgController@ajax','as'=>'admin.uploadImg.ajax']);

    // 商品管理
    Route::get('/goods/index',['uses'=>'GoodsController@index','as'=>'admin.goods.index']);
    Route::get('/goods/add',['uses'=>'GoodsController@add','as'=>'admin.goods.add']);
    Route::post('/goods/save',['uses'=>'GoodsController@save','as'=>'admin.goods.save']);
    Route::get('/goods/{id}/edit',['uses'=>'GoodsController@edit','as'=>'admin.goods.edit']);
    Route::post('/goods/update',['uses'=>'GoodsController@update','as'=>'admin.goods.update']);
    Route::get('/goods/{id}/delete',['uses'=>'GoodsController@delete','as'=>'admin.goods.delete']);

    // 商品分类
    Route::get('/goods_type/index',['uses'=>'GoodsTypeController@index','as'=>'admin.goods_type.index']);
    Route::get('/goods_type/add',['uses'=>'GoodsTypeController@add','as'=>'admin.goods_type.add']);
    Route::post('/goods_type/save',['uses'=>'GoodsTypeController@save','as'=>'admin.goods_type.save']);
    Route::get('/goods_type/{id}/edit',['uses'=>'GoodsTypeController@edit','as'=>'admin.goods_type.edit']);
    Route::post('/goods_type/update',['uses'=>'GoodsTypeController@update','as'=>'admin.goods_type.update']);
    Route::get('/goods_type/{id}/delete',['uses'=>'GoodsTypeController@delete','as'=>'admin.goods_type.delete']);

    // 会员管理
    Route::get('/member/index',['uses'=>'MemberController@index','as'=>'admin.member.index']);
    Route::get('/member/add',['uses'=>'MemberController@add','as'=>'admin.member.add']);
    Route::post('/member/save',['uses'=>'MemberController@save','as'=>'admin.member.save']);
    Route::get('/member/{id}/edit',['uses'=>'MemberController@edit','as'=>'admin.member.edit']);
    Route::post('/member/update',['uses'=>'MemberController@update','as'=>'admin.member.update']);
    Route::get('/member/{id}/delete',['uses'=>'MemberController@delete','as'=>'admin.member.delete']);
});
